package cn.leyaber.hrm.service.impl;

import cn.leyaber.hrm.domain.Travels;
import cn.leyaber.hrm.mapper.TravelsMapper;
import cn.leyaber.hrm.service.ITravelsService;
import cn.leyaber.hrm.redusutils.constants.CommentConstant;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ma.rui.kai
 * @since 2020-10-21
 */
@Service
public class TravelsServiceImpl extends ServiceImpl<TravelsMapper, Travels> implements ITravelsService {

    @Autowired
    private TravelsMapper travelsMapper;
    @Override
    public void Modify_status(Travels travels) {
        if(travels.getState().equals(CommentConstant.COMMENT_DISABLE)){
            travels.setState(CommentConstant.COMMENT_ENABLE);
            travelsMapper.updateById(travels);
        }else {
            travels.setState(CommentConstant.COMMENT_DISABLE);
            travelsMapper.updateById(travels);
        }
    }

    @Override
    public void batchDelete(List<Long> ids) {
        System.out.println(ids);
        travelsMapper.batchDelete(ids);
    }
}
